﻿using System.Collections.Generic;
using System.Linq;
using DataBaseLayer.Dto;

namespace DataBaseLayer.Extensions
{
	public static class ScheduleServiceEx
	{
		public static ScheduleServiceData ToDTO(this ScheduleService entity)
		{
			if (entity == null) return null;

			var dto = new ScheduleServiceData
			{
				Name = entity.Name,
				DayId = entity.DayId,
				ServiceId = entity.ServiceId,
				Time = entity.Time
			};

			return dto;
		}

		public static List<ScheduleServiceData> ToDTOs(this IEnumerable<ScheduleService> entities)
		{
			if (entities == null) return null;

			return entities.Select(e => e.ToDTO()).ToList();
		}
	}
}
